package cn.lidongyu.basic.commonenum;

public enum ErrorCode {
    SYSTEM_ERROR("1001","系统内部异常"),
    PAGE_ERROR("1002","分页错误");
    private String code;
    private String message;
    ErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }
    public String getCode() {
        return code;
    }
    public String getMessage() {
        return message+"["+code+"]";
    }
    public static ErrorCode getByCode(String code){
        ErrorCode[] errorCodes = ErrorCode.values();
        for(ErrorCode errorCode:errorCodes){
            if(errorCode.getCode().equals(code)){
                return errorCode;
            }
        }
        return null;
    }

}
